package main

import (
	"fmt"
	hslice "net/hh/goutil/slice"
)

func main() {
	s := []int{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}
	s1 := hslice.Map(s, func(v int, i int) int {
		return v * v
	})
	fmt.Println(s1)

	s2 := hslice.Filter(nil, func(v int) bool {
		return v%2 == 0
	})
	fmt.Println(s2)
	s2 = make([]int, 1000)
	s2[0] = 1
	s2[1] = 1
	s2[2] = 1
	s2 = hslice.Filter(s2, func(v int) bool {
		return v == 1
	})
	fmt.Println(s2)
	fmt.Println(len(s2), cap(s2))

	fmt.Println(hslice.Reduce(s, 0, func(acc int, cur int) int {
		return acc + cur
	}))

	fmt.Println(hslice.Has(s, func(i int) bool {
		return i == 2
	}))
	fmt.Println(hslice.Find(s, func(i int) bool {
		return i > 8
	}))
	hslice.Reverse(s)
	fmt.Println(s)
	var ss []string
	hslice.Reverse(ss)
}
